package org.quickjsf.core.base.viewmodel.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import javax.faces.convert.Converter;

import org.quickjsf.core.datamodel.OptionType;

public class ColumnModel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2599387651069772531L;
	
	private String header;  
    private String property;
    private Integer order;
    private Boolean format;
    private Converter converter;
    private List<OptionType> optionTypes= new ArrayList<OptionType>(0);
    
	
	public ColumnModel() {
	}
	
    public ColumnModel(String header, String property) {
		super();
		this.header = header;
		this.property = property;
		this.format = false;
	}
    
    public ColumnModel(String header, String property, Boolean format, Integer order, Converter converter) {
		super();
		this.header = header;
		this.property = property;
		this.format = format;
		this.order = order;
		this.converter = converter;
	}

	public String getHeader() {
    	return header;
    }
	
	public void setHeader(String header) {
		this.header = header;
	}
	
	public String getProperty() {
		return property;
	}
	
	public void setProperty(String property) {
		this.property = property;
	}

	public Boolean getFormat() {
		return format;
	}

	public void setFormat(Boolean format) {
		this.format = format;
	}

	public Integer getOrder() {
		return order;
	}

	public void setOrder(Integer order) {
		this.order = order;
	}
	
	public static Comparator<ColumnModel> getComparator() {
		return new Comparator<ColumnModel>(){
			@Override
			public int compare(ColumnModel o1, ColumnModel o2) {
				return o1.getOrder().compareTo(o2.getOrder());
			}
			
		};
	}

	public Converter getConverter() {
		return converter;
	}

	public void setConverter(Converter converter) {
		this.converter = converter;
	}

	public List<OptionType> getOptionTypes() {
		return optionTypes;
	}

	public void setOptionTypes(List<OptionType> optionTypes) {
		this.optionTypes = optionTypes;
	}
}
